<?php

/**
 *  Ham goi ckeditor
 * 
 * */
if (!function_exists('ckeditor'))
{
    function ckeditor($nameTextarea)
    {
        $registry = Core_Registry::singleton();
        $baseUrl  = $registry['baseUrl'];
        $out = "";
        $out.= '<script type="text/javascript" src="'.$baseUrl.'/public/js/ckeditor/ckeditor.js"></script>'."\n";
        $imageBrowseUrl = $baseUrl.'/public/js/ckeditor/filemanager/browser/default/browser.html?Type=Image&Connector=http://'.$_SERVER['HTTP_HOST'].$baseUrl.'/public/js/ckeditor/filemanager/connectors/php/connector.php';
        
        $fileBrowseUrl = $baseUrl.'/public/js/ckeditor/filemanager/browser/default/browser.html?Connector=http://'.$_SERVER['HTTP_HOST'].$baseUrl.'/public/js/ckeditor/filemanager/connectors/php/connector.php';
        $out.= '<script type="text/javascript">
                  CKEDITOR.replace( '."'$nameTextarea',".
                  "{
					language: 'vi',
                    filebrowserImageBrowseUrl : '".$imageBrowseUrl."',".
                    "filebrowserBrowseUrl : '".$fileBrowseUrl."'".
                  '	});
			       </script>';
        return $out;  
    }
}